"use strict";

//公共组件 - 导航
ym2App.controller("ym2.ctrl.public.nav", ["$scope", "$http", function ($scope, $http) {

    var isCollapse = localStorage.getItem("MenuCollapse");
    $scope.collapseShrink = false;

    if ( isCollapse ) {
        document.documentElement.setAttribute("ym2-collapse", "true");
        $scope.collapseShrink = true;
    }

    //菜单收缩/展开切换
    $scope.toggleCollapse = function () {
        if ( localStorage.getItem("MenuCollapse") ) {
            document.documentElement.removeAttribute("ym2-collapse");
            localStorage.removeItem("MenuCollapse");
            $scope.collapseShrink = false;
        } else {
            document.documentElement.setAttribute("ym2-collapse", "true");
            localStorage.setItem("MenuCollapse", "true");
            $scope.collapseShrink = true;
        }
    };

}]);